package io.renren.modules.sys.controller;

import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.common.vo.PageInfo;
import io.renren.common.vo.RV;
import io.renren.modules.sys.entity.DicGroupDetail;
import io.renren.modules.sys.service.DicGroupDetailService;



/**
 * 应用字典项信息表
 *
 * @author jingtang
 * @email sunlightcs@gmail.com
 * @date 2018-06-28 08:41:11
 */
@RestController
@RequestMapping("sys/dicgroupdetail")
public class DicGroupDetailController extends AbstractController{
    @Autowired
    private DicGroupDetailService dicGroupDetailService;

    /**
     * 列表
     */
    @RequestMapping(value = "/list",method = RequestMethod.POST)
    @RequiresPermissions("sys:dicgroupdetail:list")
    public RV list(@RequestParam Map<String,Object> param){
    	
    	return new PageInfo<>(dicGroupDetailService.selectPage(param));
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{dicGpDetailId}")
    @RequiresPermissions("sys:dicgroupdetail:info")
    public RV info(@PathVariable("dicGpDetailId") String dicGpDetailId){
    	
		DicGroupDetail dicGroupDetail = dicGroupDetailService.selectById(dicGpDetailId);

        return RV.ok(dicGroupDetail);
    }

    /**
     * 保存
     */
    @RequestMapping(value = "/save",method =  RequestMethod.POST)
    @RequiresPermissions("sys:dicgroupdetail:save")
    public RV save(@RequestBody DicGroupDetail dicGroupDetail){
			
        return RV.ok(dicGroupDetailService.saveDicGroupDetail(dicGroupDetail));
    }

    /**
     * 修改
     */
    @RequestMapping(value = "/update",method =  RequestMethod.POST)
    @RequiresPermissions("sys:dicgroupdetail:update")
    public RV update(@RequestBody DicGroupDetail dicGroupDetail){
		dicGroupDetailService.updateById(dicGroupDetail);

        return RV.ok();
    }

    /**
     * 删除
     */
    @GetMapping("/delete/{dicGpDetailId}")
    @RequiresPermissions("sys:dicgroupdetail:delete")
    public RV delete(@PathVariable("dicGpDetailId") String dicGpDetailId){
		dicGroupDetailService.deleteById(dicGpDetailId);

        return RV.ok();
    }

}
